<?php
	include('../inc/conn.php');
	include('../inc/fnc.php');

	if(isset($_POST)){
		$subscribe = $_POST['s'];
		$userid = $_SESSION['userId'];
			
		if ($subscribe == "true") {
			if(subscribe($userid)) {
				$error['type']= 'strue';	
			} else {
				$error['type']= 'false';
			}
		} elseif ($subscribe == "false")  {		
			if(unsubscribe($userid)){
				$error['type']= 'utrue';
			} else {
				$error['type']= 'false';
			}
		}	//if (mysql_num_rows($res) == 1) Ends
	}	//if(isset($_POST)) Ends
	
	echo json_encode($error);
?>
